package com.nativetalk.dao;

import com.nativetalk.bean.TdNtReserveTime;
import com.nativetalk.bean.reserve.TdNtReserveTimeDetail;
import com.nativetalk.bean.reserve.TdNtReserveTimeList;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Created by lizhun on 16/6/15.
 */
@MyBatisRepository
public interface TdNtReserveTimeDao {
    /**
     * @Purpose  查找教师可接单时间段
     * @version  3.0
     * @author   lizhun
     * @param    params
     * @return   List<TdNtReserveTimeList>
     */
    public List<TdNtReserveTimeList> findTdNtReserveTimeList(Map<String, Object> params);
    /**
     * @Purpose  查找教师某天某个时间点是否设置过时间
     * @version  3.0
     * @author   lizhun
     * @param    params
     * @return   TdNtReserveTimeDetail
     */
    public TdNtReserveTimeDetail findTdNtReserveTimeDetail(Map<String, Integer> params);
    /**
     * @Purpose  关闭或开启可预约时间
     * @version  3.0
     * @author   lizhun
     * @param    tdNtReserveTimeDetail
     * @return   void
     */
    public void updateTdNtReserveTimeDetail(TdNtReserveTimeDetail tdNtReserveTimeDetail);
    /**
     * @Purpose  添加可预约时间
     * @version  3.0
     * @author   lizhun
     * @param    tdNtReserveTimeDetail
     * @return   void
     */
    public void insertTdNtReserveTimeDetail(TdNtReserveTimeDetail tdNtReserveTimeDetail);
    /**
     * @Purpose  查找老师设置的可预约时间数量
     * @version  3.2
     * @author   lizhun
     * @param    tea_id
     * @return   int
     */
    public int findTdNtReserveTimeSize(int tea_id);

    /**
     * @param params
     * @return
     * @Purpose 查询老师预约时间表日期列表，仅有日期数据
     * @version 4.1
     * @author Peter
     */
    List<TdNtReserveTime> findTdNtReserveDateList(Map<String, Object> params);

    /**
     * @param reparedReserveTimeList
     * @Purpose
     * @version 4.1
     * @author Peter
     */
    long repaireReserveDate(List<TdNtReserveTime> reparedReserveTimeList);


    /**
     * @param params
     * @return
     * @Purpose 查找老师设置的可预约时间信息列表
     * @version 4.1
     * @author Peter
     */
    List<TdNtReserveTimeList> findTdNtReserveTime(Map<String, Object> params);

    /**
     * @param detail
     * @Purpose 根据tea_id, date, reserve_time更新is_valid
     * @version 4.1
     * @author Peter
     */
    long updateTdNtReserveTimeSetIsValid(TdNtReserveTimeDetail detail);

    /**
     * @param detail
     * @Purpose 根据tea_id, date, reserve_time更新is_valid，重复规则：EveryDay
     * @version 4.1
     * @author Peter
     */
    void updateTdNtReserveTimeSetIsValidForEveryDay(TdNtReserveTimeDetail detail);

    void deleteTdNtReserveTimeSetIsValidForEveryDay(TdNtReserveTimeDetail detail);

    /**
     * @param detail
     * @Purpose 根据tea_id, date, reserve_time更新is_valid，重复规则：Weekly
     * @version 4.1
     * @author Peter
     */
    void updateTdNtReserveTimeSetIsValidForWeekly(TdNtReserveTimeDetail detail);

    void deleteTdNtReserveTimeSetIsValidForWeekly(TdNtReserveTimeDetail detail);

    List<TdNtReserveTime> findTdNtReserveByDateAndTea_id(TdNtReserveTimeDetail detail);

    void insert(TdNtReserveTimeDetail detail);

    void insertList(@Param("pojos") List<TdNtReserveTimeDetail> pojo);

    void createClassRoom(Map<String, Object> params);

    void prepareBooked(int tea_id);
}
